<!doctype html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<title>Oneplatform企业级开发平台</title>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
		<link rel="stylesheet" href="./assets/css/font.css">
		<link rel="stylesheet" href="./assets/css/admin.css">
		<link rel="stylesheet" href="assets/js/layui/css/layui.css" media="all" />
	</head>

	<body>
		<!-- 顶部开始 -->
		<div class="container">
			<div class="logo">
				<a href="./index.html">Oneplatform</a>
			</div>
			<div class="left_open">
				<i title="展开左侧栏" class="iconfont">&#xe699;</i>
			</div>
			<ul class="layui-nav right" lay-filter="">
				<li class="layui-nav-item">
					<a href="javascript:;"><span id='userName'></span></a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:;" id="update_pwd_btn">修改密码</a>
						</dd>
						<dd>
							<a href="javascript:;" id="logout_btn" class="loginout">退出</a>
						</dd>
					</dl>
				</li>
				<li class="layui-nav-item to-index">
					<a href="http://www.jeesuite.com/tool/genProject.html" target="_blank">代码生成器</a>
				</li>
			</ul>

		</div>
		<!-- 顶部结束 -->
		<!-- 中部开始 -->
		<!-- 左侧菜单开始 -->
		<div class="left-nav">
			<div id="side-nav">
				<ul id="nav"></ul>
			</div>
		</div>
		<!-- <div class="x-slide_left"></div> -->
		<!-- 左侧菜单结束 -->
		<!-- 右侧主体开始 -->
		<div class="page-content">
			<div class="layui-tab tab" lay-filter="wenav_tab" id="WeTabTip" lay-allowclose="true">
				<ul class="layui-tab-title" id="tabName">
					<li>我的桌面</li>
				</ul>
				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show">
						<iframe src='./main.html' frameborder="0" scrolling="yes" class="weIframe"></iframe>
					</div>
				</div>
			</div>
		</div>
		<div class="page-content-bg"></div>
		<!-- 右侧主体结束 -->
		<!-- 中部结束 -->
		<!-- 底部开始 -->
		<div class="footer">
			<div class="copyright">Copyright ©2018 Oneplatform All Rights Reserved</div>
		</div>
		<!-- 底部结束 -->
		<!--Tab菜单右键弹出菜单-->
	    <ul class="rightMenu" id="rightMenu">
          <li data-type="fresh">刷新</li>
          <li data-type="current">关闭当前</li>
          <li data-type="other">关闭其它</li>
          <li data-type="all">关闭所有</li>
       </ul>
	</body>
    <script id="menuTpl" type="text/html">
     {{#  layui.each(d, function(index, item){ }}
        <li>
		  <a href="javascript:;">
			 <i class="iconfont">&#xe723;</i>
			 <cite>{{ item.name }}</cite>
			 <i class="iconfont nav_right">&#xe697;</i>
		 </a>
        {{#  if(item.children !== undefined && item.children.length > 0){ }}
		<ul class="sub-menu">
          {{#  layui.each(item.children, function(index1, item1){ }}
		  <li>
			 <a _href="{{ item1.value }}"><i class="iconfont">&#xe6a7;</i><cite>{{ item1.name }}</cite></a>
		  </li>
          {{#  }); }}
		</ul>
        {{#  } }} 
	  </li>
     {{#  }); }}
  </script>
    
    <script type="text/javascript" src="assets/js/layui/layui.js"></script>
	<script type="text/javascript">
	  var basePathMap;
	  layui.config({
	     base: './assets/js/'
		 ,version: '101100'
	  }).use(['laytpl','admin','oneplatform'], function() {
			var $ = layui.jquery,laytpl = layui.laytpl,id;
			$.getJSON('/api/user/menus',function(data){
				if(data.code && data.code==401){top.location.href = "/login.html";return;}
				var tpl = $('#menuTpl').html();
				laytpl(tpl).render(data.data, function(html){
					$('#nav').html(html);
				});
			});
		    $.getJSON('/api/user/profile',function(data){
              if(data.code == 200){
               	 $("#userName").html(data.data.userName);
               	 id = data.data.id;
              }else{
               	location.href='login.html';
              }
		   });
		    
		    $('#update_pwd_btn').on('click',function(){
				layer.open({
					  type: 2, 
					  title:'修改密码',
					  content: '/modules/account/updatepwd.html',
					  area: ['500px', '300px']
				}); 
			});
		    
		    $('#logout_btn').on('click',function(){
		    	layui.oneplatform.post('/api/user/logout',{},function(){
		    		location.href = './login.html';
		    	});
		    });
	  });
	</script>

</html>